/**
 * 
 */
package com.thor.palmmall.rest.chart.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.rest.chart.ADateRange;
import com.thor.palmmall.spi.chart.SDateRange;

/**
 * @author NuoSa
 *
 * @since 1.0
 */
public class SDateRangeConverter implements Converter<ADateRange, SDateRange> {

  public static SDateRangeConverter getInstance() {
    if (instance == null)
      instance = new SDateRangeConverter();
    return instance;
  }

  private static SDateRangeConverter instance;

  private SDateRangeConverter() {
  }

  @Override
  public SDateRange convert(ADateRange source) {
    if (source == null) {
      return null;
    }
    SDateRange target = new SDateRange();
    target.setBeginDate(source.getBeginDate());
    target.setEndDate(source.getEndDate());
    return target;
  }

}
